[The VIC 6567]                                                             [IMG] 
  ----------------------------------------------------------------------------
[VIC 6567 - chip]       [IMG]0.Pinconnection                                     
                                                                                 
                        [IMG]1.Memory and Timing                                 
                           [IMG]1.1.Registers                                    
                           [IMG]1.2.VIC-bank's                                   
                           [IMG]1.3.Screenbuilding                               
                                                                                 
                        [IMG]2.Grafixmodes                                       
                           [IMG]2.1.Hires-Mode                                   
                           [IMG]2.2.Multicolor-Mode                              
                           [IMG]2.3.Extendet-Background-Color-Mode               
                           [IMG]2.4.FLI                                          
                           [IMG]2.5.IFLI                                         
                                                                                 
                        [IMG]3.Sprites                                           
                           [IMG]3.1.General                                      
                           [IMG]3.2.Exampleprogram for Spriteinitialization      
                           [IMG]3.3.Multiplexing (not available yet)             
                                                                                 
                        [IMG]4.Colors                                            
  ----------------------------------------------------------------------------

    

0.PINCONNECTION                                                            [IMG] 

    

+------------------------------------------------------------------------------+ 
| PIN            | NAME              | FUNCTION                                | 
|----------------+-------------------+-----------------------------------------| 
| 1              | D6                | CPU Databus                             | 
|----------------+-------------------+-----------------------------------------| 
| 2              | D5                | CPU Databus                             | 
|----------------+-------------------+-----------------------------------------| 
| 3              | D4                | CPU Databus                             | 
|----------------+-------------------+-----------------------------------------| 
| 4              | D3                | CPU Databus                             | 
|----------------+-------------------+-----------------------------------------| 
| 5              | D2                | CPU Databus                             | 
|----------------+-------------------+-----------------------------------------| 
| 6              | D1                | CPU Databus                             | 
|----------------+-------------------+-----------------------------------------| 
| 7              | D0                | CPU Databus                             | 
|----------------+-------------------+-----------------------------------------| 
| 8              | IRQ               | Interrupt-output                        | 
|----------------+-------------------+-----------------------------------------| 
| 9              | LP                | Lightpen-input                          | 
|----------------+-------------------+-----------------------------------------| 
| 10             | [CS]              | Chip Select Input                       | 
|----------------+-------------------+-----------------------------------------| 
| 11             | [R/W]             | Read/Write Input                        | 
|----------------+-------------------+-----------------------------------------| 
| 12             | BA                | Bus Available                           | 
|----------------+-------------------+-----------------------------------------| 
| 13             | VDD               | +12 V                                   | 
|----------------+-------------------+-----------------------------------------| 
| 14             | COL               | Colorinformation-output                 | 
|----------------+-------------------+-----------------------------------------| 
| 15             | S/LUM             | Synchronisation-output                  | 
|----------------+-------------------+-----------------------------------------| 
| 16             | AEC               | Adress-Enable-Control-output            | 
|----------------+-------------------+-----------------------------------------| 
| 17             | o/0               | Systemtact                              | 
|----------------+-------------------+-----------------------------------------| 
| 18             | RAS               | Rowadress-output                        | 
|----------------+-------------------+-----------------------------------------| 
| 19             | CAS               | Columnadress-output                     | 
|----------------+-------------------+-----------------------------------------| 
| 20             | Gnd               | Mass                                    | 
|----------------+-------------------+-----------------------------------------| 
| 21             | o/COL.            | Colorfrequence-input                    | 
|----------------+-------------------+-----------------------------------------| 
| 22             | o/in              | Tactfrequence-input                     | 
|----------------+-------------------+-----------------------------------------| 
| 23             | A11               | CPU Adressbus                           | 
|----------------+-------------------+-----------------------------------------| 
| 24             | A0/A8             | multipl. Video-RAM Adressbus            | 
|----------------+-------------------+-----------------------------------------| 
| 25             | A1/A9             | multipl. Video-RAM Adressbus            | 
|----------------+-------------------+-----------------------------------------| 
| 26             | A2/A10            | multipl. Video-RAM Adressbus            | 
|----------------+-------------------+-----------------------------------------| 
| 27             | A3/A11            | multipl. Video-RAM Adressbus            | 
|----------------+-------------------+-----------------------------------------| 
| 28             | A4/A12            | multipl. Video-RAM Adressbus            | 
|----------------+-------------------+-----------------------------------------| 
| 29             | A5/A13            | multipl. Video-RAM Adressbus            | 
|----------------+-------------------+-----------------------------------------| 
| 30             | A6                | Video-RAM Adressbus                     | 
|----------------+-------------------+-----------------------------------------| 
| 31             | A7                | Video-RAM Adressbus                     | 
|----------------+-------------------+-----------------------------------------| 
| 32             | A8                | CPU Adressbus                           | 
|----------------+-------------------+-----------------------------------------| 
| 33             | A9                | CPU Adressbus                           | 
|----------------+-------------------+-----------------------------------------| 
| 34             | A10               | CPU Adressbus                           | 
|----------------+-------------------+-----------------------------------------| 
| 35             | D11               | Databus Color-RAM                       | 
|----------------+-------------------+-----------------------------------------| 
| 36             | D10               | Databus Color-RAM                       | 
|----------------+-------------------+-----------------------------------------| 
| 37             | D9                | Databus Color-RAM                       | 
|----------------+-------------------+-----------------------------------------| 
| 38             | D8                | Databus Color-RAM                       | 
|----------------+-------------------+-----------------------------------------| 
| 39             | D7                | CPU Databus                             | 
|----------------+-------------------+-----------------------------------------| 
| 40             | VCC               | +5 V                                    | 
+------------------------------------------------------------------------------+ 

    

     ----------------------------------------------------------------------

1.MEMORY AND TIMING                                                        [IMG] 

    

1.1.REGISTERS                                                              [IMG] 
            
The VIC has 64 of it, but there are only 47 used registers.
The baseadress is $d000.
  ----------------------------------------------------------------------------
Adress                                                                           
  ----------------------------------------------------------------------------
$d000       x-position of sprite 1                                               
$d001       y-position of sprite 1                                               
$d002       x-position of sprite 2                                               
$d003       y-position of sprite 2                                               
            . . . you have 8 sprites, so you need 16($10) registers.             
  ----------------------------------------------------------------------------
$d010       Sprite-x-position-overstep;                                          
            coz you've a possible x-position of more than 256($100) you need a   
            9th bit to lokalize the x-position of a sprite; you have 8 sprites   
            and all need a 9th bit, so you need a byte; this byte is $d010; for  
            every sprite one bit for x-overstep;                                 
  ----------------------------------------------------------------------------
$d011       bit 0-2: you can move the screen pixel for pixel vertical for all in 
                     all 7 pixels with this 3 bits (for softscrolling or other   
                     specialeffects);                                            
            bit 3 :  you can change row-mode between 0: 24 rows/charlines 1: 25  
                     rows/charlines;                                             
            bit 4 :  to switch off the screen                   0: off   1: on   
            bit 5 :  standart bitmap mode (high resoloution)    0: off   1: on   
            bit 6 :  extendet-background-color-mode             0: off   1: on   
            bit 7 :  like $d010 for the sprites, is this the overstep of the     
                     raster(ray) from register $d012, coz there are more than    
                     256($100) rasterlines, all in all there are 312($138)       
                     possible rasterlines;                                       
  ----------------------------------------------------------------------------
$d012       Vertical-raster-position;                                            
            if you write to $d012, the VIC triggers a IRQ if the rasterline      
            you've written to $d012, is reached; if you read $d012 you get the   
            actual rasterline, where the VIC is building the screen that moment; 
            this register is the most important and always used for all          
            timingeffects (like rasterbars, multiplexing...);                    
  ----------------------------------------------------------------------------
$d013       x-part of screeposition                                              
            at which the raster(ray) at the moment when a strobe was triggered,  
            had been;                                                            
$d014       y-part of screeposition                                              
            like $d013; these both registers are thought for using lightpen;     
  ----------------------------------------------------------------------------
$d015       Sprite-enable;                                                       
            register to activate sprites; every sprite one bit(0-7), if the bit  
            is high(1) the sprite is to see on screen;                           
  ----------------------------------------------------------------------------
$d016       bit 0-2: you can move the screen pixel for pixel horizontally for    
                     all in all 7 pixels with this 3 bits                        
                     (for softscrolling or other specialeffects);                
            bit 3 :  you can change coloumn-mode       0: 38 cols   1: 40 cols   
                     between                                                     
            bit 4 :  multicolor mode                   0: off       1: on        
            bit 5-7: unused?                                                     
  ----------------------------------------------------------------------------
$d017       Sprite-x-expand;                                                     
            register to expand sprites horizontal; every bit one sprite;         
  ----------------------------------------------------------------------------
$d018       bit 0 :   unused?, but always high(1) or low(0)?;                    
            bit 1-3:  Charset-Baseadress-Pointer;                                
                      you can move it within the VIC-bank in $0800 steps:        
                                                                                 
                      Baseadress       $d018 Bit 0-3 value                       
                      $0000-$07ff      %0001                                     
                      $0800-$0fff      %0011                                     
                      $1000-$17ff      %0101 -> not in the VIC-bank 0 and 2;     
                      $1800-$1fff      %0111 -> not in the VIC-bank 0 and 2;     
                      $2000-$27ff      %1001                                     
                      $2800-$2fff      %1011                                     
                      $3000-$37ff      %1101                                     
                      $3800-$3fff      %1111                                     
                                                                                 
                      bit 3 also is responsible for moving the bitmap            
                      (while bitmapmode -> $d011 bit 5) in the memory:           
                      $0000-$1fff                      %0xx1                     
                      $2000-$3fff                      %1xx1                     
            bit 4-7:  Videoram-pointer;                                          
                      you can move it in the VIC-bank in $0400 steps;            
                                                                                 
                      $0000-$03e7 #00 = %0000                                    
                      $0400-$07e7 #01 = %0001 -> here videoram normally is saved 
                      $0800-$0be7 #02 = %0010                                    
                      $0c00-$0fe7 #03 = %0011                                    
                      $3800-$3be7 #14 = %1110                                    
                      $3c00-$3fe7 #15 = %1111                                    
  ----------------------------------------------------------------------------
$d019       IRR (Interruptrequestregister);                                      
            a bit(0-3) gets high(1) if the occurence happens which triggers a    
            IRQ                                                                  
                                                                                 
            bit 0 :    $d012;                                                    
            bit 1 :    $d01f;                                                    
            bit 2 :    $d01e;                                                    
            bit 3 :    lightpen;                                                 
            bit 4-6:   unused?                                                   
            bit 7 :    gets high(1) if one of the other bits (0-3) gets high(1); 
                                                                                 
            if the VIC triggered a IRQ you have to write to $d019 (not nil, for  
            instance lda #$01; sta $d019;), then VIC knows that IRQ was          
            executed;                                                            
  ----------------------------------------------------------------------------
$d01a       IMR (Interruptmaskregister);                                         
            here you can define, which happenings should trigger a IRQ;          
                                                                                 
            bit 0 : raster triggers the IRQ;                                     
            bit 1 : a IRQ is triggered if a sprite collides with a               
                    foregroundpixel;                                             
            bit 2 : a IRQ is triggerd if sprites collide; the number of sprites  
                    which collided you can see in $d01e;                         
                                                                                 
            bit 7 of $d019 becomes high(1) if both one of these(IMR) and the     
            corresponding bit of $d019(IRR) becomes high(1);                     
            if that happens, the pin IRQ at the VIC 6567 gets low (0);           
  ----------------------------------------------------------------------------
$d01b       Sprite-background-priority                                           
            here can be defined; every sprite one bit;                           
            0 : sprite has priority and covers background partly;                
            1 : background/chars/screen has priority and sprite is partly        
            covered;                                                             
  ----------------------------------------------------------------------------
$d01c       Sprite-multicolor-mode;                                              
            every bit one sprite to switch it on;                                
  ----------------------------------------------------------------------------
$d01d       Sprite-y-expand;                                                     
            register to expand sprites vertical; every bit one sprite;           
  ----------------------------------------------------------------------------
$d01e       Sprite-Sprite-Collision                                              
            if sprites collided, here you see which sprites that were;           
            the corresponding bits gets high(1);                                 
            after reading you have to clear the bits because they don't clear    
            themself;                                                            
  ----------------------------------------------------------------------------
$d01f       Sprite-Background-Collision                                          
            if sprites collide with a backgroundsign the corresponding bits get  
            high;                                                                
            also like in $d01e you've to clear bit's after reading the;          
  ----------------------------------------------------------------------------
$d020       Exterior-color;                                                      
            color of the border/frame;                                           
$d021       Background-color 0;                                                  
            background color in normal-text-mode and multicolor-mode;            
$d022-$d024 Background-color 1-3;                                                
            in these three registers are the 3 colors saved needed for           
            extendet-background-color-mode, to activate in $d011, bit 6;         
            multicolor-mode, to activate in $d016, bit 4;                        
  ----------------------------------------------------------------------------
$d025-$d026 Sprite-multicolor 0-1;                                               
            in these two registers are the 2 other colors saved needed for       
            sprite-multicolor-mode, to activate in $d01c;                        
$d027-$d02e Sprite-color;                                                        
            every sprite 1 byte;                                                 
  ----------------------------------------------------------------------------
$d02f       unused?;                                                             
  ----------------------------------------------------------------------------
$d030       this is only a C128-register; to beware that your code is            
            C128-compatible, you should the following know:                      
                                                                                 
            bit 0 : at C128 you can change between 1MHz and 2MHz of  1 = 2MHz    
                    CPU-tact:                                        0 = 1MHz    
            bit 1 : here you can switch off the VIC:                 1 = VIC off 
                                                                     0 = VIC on; 
            bit 2-7 unused?;                                                     
  ----------------------------------------------------------------------------
$d031-$d03f unused?;                                                             
  ----------------------------------------------------------------------------
All these registers repeats at $d040 and $d080... till $d400. At $d400 the
musicchip SID 6581 has it's baseadress.

    

   --------------------------------------------------------------------------

    

1.2.VIC-BANK:                                                              [IMG] 
                                        
The size of the adressarea of the VIC is only $4000 bytes (16kB). If you want to
save a font, bitmap or sprites behind $4000 you've to move the VIC-bank. This is
possible in the first 2 bits of the first register of NMI-CIA-2: $dd00.
                                                                                 
Bank (baseadress)                       $dd00 (bit 0-1) value                    
bank 0 ($0000-$3fff)                    %11 = $03                                
bank 1 ($4000-$7fff)                    %10 = $02                                
bank 2 ($8000-$bfff)                    %01 = $01                                
bank 3 ($c000-$ffff)                    %00 = $00                                
                                                                                 
At $1000 (bank 0) and $9000 (bank 2) the VIC see's always the ROM-font, that's
why at $1000 and $9000 you can't usefully save sprites, videoram, bitmaps or
your own fonts. So programmers mostly save music to this memoryarea.
The last byte of all banks ($3fff,$7fff,$bfff,$ffff) is the so called ghostbyte.
This byte is hidden under border. You see it if you scroll the screen in
25/40-row/col-mode vertical/horizontal, while FLD or opened border. So it's
better to write $00 to it and you see no byte, or you can do some specialeffects
by using it in the right timing.        
In extendet-background-color-mode the ghostbyte is at VIC-bank+$39ff.

    

   --------------------------------------------------------------------------

    

1.3.SCREENBUILDING:                                                        [IMG] 
                                                                                 
The screen becomes built new every 1/50 second.                                  
Then the raster(ray) begins to write screenbuilding pixel by pixel in left upper 
corner, line 0.                                                                  
While one line the CPU counts 63($3f) tactcycles. In this 63 cycles the CPU and  
the VIC shares the bus and the memory, and these 63 cycles. The first halftact   
is for the CPU and the second the VIC uses to read a byte of the current sign.   
Normally the VIC shows 200 lines of graphics between the lines 50($32) and       
249($fa) resp.                                                                   
192 lines between 54($36) and 245($f7) if you are in 24-row-mode.                
This can be increased to 207 lines by turning off the border and doing some      
fancy scrolling. These restrictions aren't valid for sprites. They can appear    
anywhere on the screen, at least if the borders are turned off.                  
Every time the lower 3 bits of $d011 equal the lower 3 bits of $d012, the VIC    
triggers a so called DMA(Direct-Memory-Access) and eats at least 40 extra-cycles 
that are normally used by the processor. In these so called badlines the VIC has 
not only to read the usual 40 bytes from charset/bitmap to display the graphic,  
it has also to read the video- and the color-ram to know WHAT graphics to        
display. That's why it uses the extratime.                                       

    

     ----------------------------------------------------------------------

2.GRAFIXMODES:                                                             [IMG] 

    

2.1.HIRES-MODE:                                                            [IMG] 
                                                                                 
Bitmap:                                                                          
In this mode you have a pixelscreen with the "high"resolution of 320*200. you    
have in every 8*8 field two different colors. This colors are saved in the low-  
and the highnibble of the videoram. lownibble : backgroundcolor (if no pixel is  
set)                                                                             
highnibble: pixelcolor (color of the pixel, if you've set once)                  
1 bit represent 1 pixel, so 8 pixels form a byte. The next byte is directly      
below the first, and 8 bytes are orderd one beneath the other.                   
So the screen is built of 40*25 8*8-fields, respectively of 8 bytes. The bitmap  
is saved in the memory of $0000-$2000($1f40) or at $2000-$4000($3f40) relative   
to the current VICbankbaseadress.                                                
The bitmap:                                                                      
                                                                                 
            FIELDS OF 8*8 BYTE-PACKAGES                                          
              0.      1.      2.     3.     4.    ...   38.    39.               
              40.     41.    42.    43.    44.    ...   78.    79.               
              ...     ...    ...    ...    ...    ...   ...    ...               
             960.    961.    962.   963.   964.   ...   998.   999.              
                                                                                 
            BYTEORDER WITHIN THE PACKAGES                                        
                0.                  0.                0.      ...                
                1.                  1.                1.      ...                
                2.                  2.                2.      ...                
               ...                 ...               ...      ...                
                7.                  7.                7.      ...                
                                                                                 
                0.                  0.                0.      ...                
                1.                  1.                1.      ...                
                2.                  2.                2.      ...                
               ...                 ...               ...      ...                
                7.                  7.                7.      ...                
                                                                                 
Sprites:                                                                         
In HIRES-mode sprites have a resolution of 24*21 pixel. You can display within 1 
sprite only 1 color, saved in $d027+spritenumber. 1 dot correspondent to 1 bit   
and 8 dots/bits characterize 1 byte of the map. A high bit(1) in the map means a 
set dot and a low bit(0) means no dot.                                           
                                                                                 
Textscreen:                                                                      
You have a normal textscreen of 40/38*25/24 characters. All chars have a 8*8     
bitmatrix and consists of 1 byte. This byte characterizes the face of the char.  
You have a font and the byte is a index to this font. The font consists of 256   
chars. So you can show 256 different chars at the same time on the screen. Also  
it's possible to split the screen, but this later.                               

    

   --------------------------------------------------------------------------

    

2.2.MULTICOLOR-MODE:                                                       [IMG] 
                                                                                 
Bitmap:                                                                          
In multicolormode you've a resolution of only 160*200 pixel, because you need 2  
bits to characterize the color of one pixel. With these 2 bits, you can encode 4 
different colors, which are saved under following memoryadresses:                
                                                                                 
            BITCONSTELLATION           COLOR SAVED AT                            
              ----------------------------------------------------               
            %00                        $d021                                     
            %01                        highbyte of videoram                      
            %10                        lowbyte of videoram                       
            %11                        $d800-$dbff                               
              ----------------------------------------------------               
                                                                                 
So it's possible to use 4 different colors within each 4*8 pixel (8*8 bit)       
matrix, but $d021 is usually fixed for the whole screen.                         
                                                                                 
Sprites:                                                                         
In spritemulticolor it's the same like bitmapmode. 2 bits - one pixel. So you've 
only a resolution of 12*21 pixels for the whole sprite. The different possible   
colors are saved in following registers:                                         
                                                                                 
            BITCONSTELLATION    COLOR SAVED AT                                   
              ----------------------------------------------------               
            %00                 $d021/$d800-$dbff                                
            %01                 $d025                                            
            %10                 $d027-$d02e (current spritecolor)                
            %11                 $d026                                            
              ----------------------------------------------------               

    

   --------------------------------------------------------------------------

    

2.3.EXTENDET-BACKGROUND-COLOR-MODE:                                        [IMG] 
                                                                                 
Only ingenious to use in textmode!                                               
If you combine multicolor-mode and ebcm-mode, you only see a black screen.       
You can only use the first 64($40) chars of your font because the                
backgroundcolor is defined by a pointer, saved in bit 6 and 7 of the char.       
The colors you can use are saved in registers $d021-$d024. The bitconstellation: 
                                                                                 
            BITCONSTELLATION              COLOR SAVED AT                         
              ----------------------------------------------------               
            %00                           $d021                                  
            %01                           $d022                                  
            %10                           $d023                                  
            %11                           $d024                                  
              ----------------------------------------------------               
                                                                                 
You also should know, that the ghostbyte in ebcm is at VIC-bankbaseadress +      
$39ff                                                                            
not like normal at VIC-bankbaseadress + $3fff.                                   

    

   --------------------------------------------------------------------------

Also there are grafixmodes possible for higher colorresolution than hires or     
multicolor, just by using timingregister $d012 and moderegisters $d011, $d016    
and $d018. Here are some of this modes:                                          

    

2.4.FLI:                                                                   [IMG] 
                                                                                 
FLI means Flexible Line Interpretation.                                          
It's multicolormode combined with a little timingroutine.                        
You've to change moderegister $d011 and $d018 every rasterline.                  
                                                                                 
1. $d018:                                                                        
Change the value of $d018 in $10 steps every rasterline ($08-$78 or $88-$f8) and 
you have in a 8*8(multicolor -> 4*8) matrix in every line 4 different colors.    
Only the colorram($d800-$dbff) is in the matrix the same and the backgroundcolor 
all over the screen.                                                             
                                                                                 
2. $d011:                                                                        
Read the lower 3 bits of $d012 and write the value to the correspondent bits of  
$d011 and you've every rasterline a badline. The best it is to use               
VICbank1($4000-$7fff), because you need the full VICram for the bitmap and       
colorram.                                                                        
An example for memoryorganisation:                                               
                                                                                 
            MEMORY             ...REPRESENTS       $d018-VALUE                   
              ----------------------------------------------------               
            $4000-$43ff        videoram 0          #$08                          
            $4400-$47ff        videoram 1          #$18                          
            $4800-$4bff        videoram 2          #$28                          
            $4c00-$4fff        videoram 3          #$38                          
            $5000-$53ff        videoram 4          #$48                          
            $5400-$57ff        videoram 5          #$58                          
            $5800-$5bff        videoram 6          #$68                          
            $5c00-$5fff        videoram 7          #$78                          
              ----------------------------------------------------               
            $6000-$8000        bitmap              #$x8                          
                                                                                 
$dd00 : #$02                                                                     
$d011 : #$3x ($8 [kleiner gleich] x [kleiner gleich] $f)                         
$d018 : #$x8 ($0 [kleiner gleich] x [kleiner gleich] $7)                         
The disadvantages of this mode are                                               
1.the big memory used,                                                           
2.because of timing- and memoryproblems you can't combine this mode with sprites 
3.you need very much rastertime for this timingroutine, 2/3 of all.              

    

   --------------------------------------------------------------------------

    

2.5.IFLI:                                                                  [IMG] 
                                                                                 
It's the Interlazed mode of FLI, that means, you have 2 bitmaps and change every 
frame the shown one. For example change every frame the VICbank. But in this     
mode you've the half of memory only for bitmap allocated!                        

    

    

     ----------------------------------------------------------------------

3.SPRITES:                                                                 [IMG] 

    

3.1.GENERAL                                                                [IMG] 
                                                                                 
Sprites are little, simple movable gfxobjects.                                   
Sprites consists of a 3*21 byte-matrix, every bit represents a pixel in the      
sprite:                                                                          
                                                                                 
                 1st Byte           2nd Byte           3rd Byte                  
                 4th Byte             ...                                        
                                      ...             63th Byte                  
                                                                                 
That's why sprites consists of a 24*21 pixel bitmap and you can normally display 
only one color within this bitmap. Let's tell you how to display a sprite.       
                                                                                 
1st step is to trace a bitmap. For that you can use one of the many existing     
spriteeditors or a modulspriteeditor (FC III, AR MK-VI, ...). You also can paint 
it on paper and calculate the values of the bytes by hand.                       
Now you have to code a little program (either BASIC or better Assembler).        
                                                                                 
2nd step. To use the painted sprite you have to save it to memory, or better     
embed the spritedata into your program and let the program save it to memory.    
You have to save your sprite to an adress which is a multiple of 64($40). The    
possible endings of this address is $00, $40, $80, $c0. Of course sprites only   
can be saved to the adressarea of the active VIC bank. In bank 0 and 2 you can't 
use memory between $1000 and $1fff /pointers $40-$7f. (-> 1.2.VIC-Bank)          
Then you have to decide which number your sprite should have (0, 1, 2, ..., 7    
are possible).                                                                   
Now you have the VIC to know the adress where you saved the spritedata. Therefor 
you have to write the pointer of your chosen adress to the end of videoram.      
Normally at $07f8 + spritenumber and in gerneral you have to write the pointer   
to                                                                               
                                                                                 
            VICbankbaseadress + videorambase + $03f8 + spritenumber              
                                                                                 
              pointer = ( spriteadress - VICbankbaseadress ) / $40               
                                                                                 
3rd step. If the spritedata is saved to memory and VIC knows where the sprite is 
located you have to color it and fix the start-point. The color of each sprite   
is saved in normal mode at                                                       
$d027 + spritenumber. So you just have to write the number of the color to the   
corresponding register. The screenposition of each sprite is divided to x- and   
y-position.                                                                      
                                                                                 
        x-position                       y-position                              
          ------------------------------------------------------------           
        $d000 + 2*spritenumber           $d001 + 2*spritenumber                  
          ------------------------------------------------------------           
                                                                                 
y-position is definite, but x-position is possibly more than 255($ff). In this   
case you have to activate the sprite-corresponding bit in $d010 and the position 
is 255($ff) + value of x-position-register. Sprites are also displayed under the 
border. If you switch it off by using some fancy timingroutines you can display  
signs or grafix even in the area of the C64-screenborder.                        
Because the vertical size of the screen is also longer than 255($ff) lines you   
see the sprite while inactive border partly double. This can be prevented by a   
timingroutine which switches on and off the sprite at the moments when it should 
be displayed or not.                                                             
                                                                                 
4th step. At last you have to enable the sprite. It becomes enabled by           
activating the corresponding bit (relative to the spritenumber 0, 1, ..., 7) in  
$d015. It's recommended to do that with an OR operation. Thus other possibly     
enabled sprites don't become killed.                                             
Enabling the sprite should be the very last action of initializing it, because   
it looks very bad if you change size, color, bitmap or other spriteoptions while 
it's already indicated to the screen.                                            
                                                                                 
You also should know:                                                            
You can double the size of sprites but in this case pixels also have double      
size.                                                                            
This is possible by activating the sprite-corresponding bits in $d017 or $d01d.  
                                                                                 
Sprites also can be displayed in multicolor mode, to enable in $d01c. Then the   
resolution is only 12*21 pixels, because 2 bits represent one pixel and encode   
the color. (-> 2.2.Multicolormode)                                               
                                                                                 
In $d01b it's possible to adjust the sprite-background priority. If it should    
appear below the signs on screen you have to activate the sprite-corresponding   
bit and the signs possibly cover the sprite partly. Otherwise you have to clear  
the bit and the sprite covers signs partly.                                      
                                                                                 
Because the sprite-bitmap aligns to 64($40)-byte-boundaries and a sprite-bitmap  
eats only 63($3f) bytes you have 1 byte left. It might be used to save further   
information, maybe the color, expansion, hires/multicolor or something like      
that.                                                                            

    

   --------------------------------------------------------------------------

    

3.2.SPRITEINITIALIZING                                                     [IMG] 
                                                                                 
  ;--------------------------------------------------------------------------    
             * =$2000                     ;startadress of the program            
  ;--------------------------------------------------------------------------    
             jsr $e544                    ;-os-routine of clrscr                 
             ldx #$3f                     ;-set index for the loop               
  sprin      lda sprdat,x                 ;-loop for writing spritedata          
             sta $3000,x                  ; to memory                            
             dex                                                                 
             bpl sprin                                                           
             lda sprdat+63                ;-read spritecolor from table and      
             sta $d027                    ; write to spritecolor of sprite 1     
             lda #$c0                     ;-set x-position to 192                
             sta $d000                                                           
             lda #$80                     ;-set x-position to 128                
             sta $d001                                                           
             lda #$c0                     ;-set spritepointer of sprite 1        
             sta $07f8                    ; to $3000 = $c0*$40                   
             lda #$01                     ;-enable                               
             sta $d017                    ; -x enlarging of the sprite           
             sta $d01d                    ; -y enlarging of the sprite           
             sta $d015                    ; -sprite 1                            
             rts                          ;return to basic/mainprogram           
  ;---------------------------------------------------------------------------   
  sprdat     .byte $ff, $ff, $ff, $ff,    ;-spritedata                           
             $ff, $ff                                                            
             .byte $ff, $ff, $ff, $ff,    ;- [screen after running the prg]      
             $ff, $ff                     ; this screen will appear after        
             .byte $ff, $ff, $ff, $ff,    runnig                                 
             $ff, $ff                     ; this little program                  
             .byte $ff, $ff, $ff, $ff,                                           
             $ff, $ff                                                            
             .byte $ff, $ff, $ff, $ff,                                           
             $ff, $ff                                                            
             .byte $ff, $ff, $ff, $ff,                                           
             $ff, $ff                                                            
             .byte $ff, $ff, $ff, $ff,                                           
             $ff, $ff                                                            
             .byte $ff, $ff, $ff, $ff,                                           
             $ff, $ff                                                            
             .byte $ff, $ff, $ff, $ff,                                           
             $ff, $ff                                                            
             .byte $ff, $ff, $ff, $ff,                                           
             $ff, $ff                                                            
             .byte $ff, $ff, $ff, $02                                            
  ;---------------------------------------------------------------------------   

    

   --------------------------------------------------------------------------

    

3.3.MULTIPLEXING                                                           [IMG] 

    

    

     ----------------------------------------------------------------------

4. COLORS:                                                                 [IMG] 

    

  ----------------------------------------------------------------------------
NUMBER     RGB VALUE     COLOR             NUMBER    RGB VALUE    COLOR          
  ----------------------------------------------------------------------------
0          #000000       BLACK             8         #E0A040      ORANGE         
1          #FFFFFF       WHITE             9         #9C7448      BROWN          
2          #E04040       RED               10        #FFA0A0      LIGHT-RED      
3          #60FFFF       TURQUOISE         11        #545454      LIGHT-GREY     
4          #E060E0       PURPLE            12        #888888      GREY           
5          #40E040       GREEN             13        #A0FFA0      LIGHT-GREEN    
6          #4040E0       BLUE              14        #A0A0FF      LIGHT-BLUE     
7          #FFFF40       YELLOW            15        #C0C0C0      DARK-GREY      
  ----------------------------------------------------------------------------

    

     ----------------------------------------------------------------------

